package com.yohann.designPattern.builder;

/**
 * <p>
 * 指挥者
 * </p>
 *
 * @author Yohann
 * @since 2021/2/2 16:53
 */
public class HouseDirector {
    HouseBuilder houseBuilder = null;

    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    /**
     * 执行制作流程
     *
     * @return 返回房子
     */
    public House constructHouse() {
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();

        return houseBuilder.house;
    }
}